# encoding=utf-8
from utils.common_import import *
from .model import NodeRebootSchema
from .node_reboot import findContainerInfo

# 获取集群重启信息
class NodeReboot(Resource):
    # @jwt_required()
    @request_arg_check(NodeRebootSchema(), many=False, location="args")
    @exception_response()
    def get(self):
        start_time = current_schema_instance['start_time']
        end_time = current_schema_instance['end_time']
        logger.info("start_time:{} end_time:{}".format(start_time, end_time))

        # 前端传过来的是毫秒，prometheus需要秒
        result = findContainerInfo(cluster_client.prometheus_client, start_time/1000, end_time/1000)

        return make_success_response(result)


